from testinput import test_if_int2


# 向文件中添加数据
def InPutFunction(main_list):
    # 定义一个空列表，依次输入数据并追加于其后
    new_information = [input("请输入ID:>"), input("请输入名字:>")]
    info_age, judge = test_if_int2.test_if_int_function(input("请输入年龄:>"))
    if judge:
        new_information.append(info_age)
        new_information.append(input("请输入性别:>"))
        # 将数据追加于主列表并返回
        main_list.append(new_information)
    else:
        print("添加失败")
    return main_list


if __name__ == '__main__':
    test_list = [["ID", "name", "age", "sex"]]
    test_list = InPutFunction(test_list)
    print(test_list)
